package com.liull.papersystem.config;

import com.liull.papersystem.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Descriotion:
 * @Author longlong.liu
 * @Version 1.0
 * @Date 2021/10/27 14:07
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Autowired
    @Qualifier("loginInterceptor")
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration registration = registry.addInterceptor(loginInterceptor);
        registration.addPathPatterns("/**");
        registration.excludePathPatterns("/user/login", "/login", "/captcha/**",
                "/user/logout",
                "/layui/**",
                "/lib/**", "/webjars/**", "/layuimini/**", "/api/**", "/images/**", "/emp/**");
    }
}
